package com.midou.administration.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.midou.administration.bo.IngredientsBo;
import com.midou.administration.bo.IngredientsBoB;
import com.midou.administration.bo.IngredientsBoFenye;
import com.midou.administration.bo.KuncunBo;
import com.midou.administration.entity.Ingredients;
import com.midou.administration.service.impl.IngredientsServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author MrChen
 * @since 2021-03-24
 */
@RestController
@RequestMapping("/administration/ingredients")
public class IngredientsController {
    @Autowired
    private IngredientsServiceImpl ingredientsService;

    /**
     * 查询全部库存
     * @return
     */
    @RequestMapping("/see")
    public Page kucun(@RequestBody IngredientsBoFenye fenye){
        return ingredientsService.seekuncun(fenye);
    }

    /**
     * 根据条件赛选库存
     * @param kuncunBo
     * @return
     */
    @RequestMapping("/qurey")
    public List<IngredientsBo> qurey(@RequestBody KuncunBo kuncunBo){
        List<IngredientsBo> list=ingredientsService.querymen(kuncunBo.getIndex(), kuncunBo.getName(),kuncunBo.getBusinessId());
        return ingredientsService.querymen(kuncunBo.getIndex(), kuncunBo.getName(),kuncunBo.getBusinessId());
    }

    /**
     * 添加食材
     */
    @RequestMapping("/Addmany")
    public int addmany(@RequestBody IngredientsBoB ingredientsBoB){
        return ingredientsService.tadd(ingredientsBoB);
    }

    /**
     * 删除方法
     */
    @RequestMapping("/dele")
    public int dele(@RequestBody Integer id){
        return ingredientsService.dele(id);
    }
}
